package io.gbznt.modules.buss.constatnt;

/**
 * rtu设备类型；
 */
public enum RtuEquipmentTypeEnum {
	/**
	 * 水温器
	 */
	WATER_TEMPERATURE(6, "水温器"),
	/**
	 * 水位器
	 */
	WATER_DEPTH(1, "水位器"),
	/**
	 * 闸门
	 */
	GATE(2, "闸门"),
	/**
	 * 风速器
	 */
	WIND_VELOCITY(3, "风速器"),
	/**
	 * 风向器
	 */
	WIND_DIRECTION(4, "风向器"),
	/**
	 * 太阳能电池
	 */
	SOLAR_CELL(5, "太阳能电池"),
	/**
	 * 太阳能电池
	 */
	OPTO_SENSOR(7, "光传感器");

	private final int value;

	private final String description;

	private RtuEquipmentTypeEnum(int value, String description) {
		this.value = value;
		this.description = description;
	}

	public int getValue() {
		return value;
	}

	public String getDescription() {
		return description;
	}

	public static RtuEquipmentTypeEnum getByValue(Integer value) {
		if (null == value) {
            return null;
        }
		for (RtuEquipmentTypeEnum enumObj : RtuEquipmentTypeEnum.values()) {
			if (value.equals(enumObj.getValue())) {
                return enumObj;
            }
		}
		return null;
	}

	public static RtuEquipmentTypeEnum getByDesc(String description) {
		if (null == description) {
            return null;
        }
		for (RtuEquipmentTypeEnum enumObj : RtuEquipmentTypeEnum.values()) {
			if (description.equals(enumObj.getDescription())) {
                return enumObj;
            }
		}
		return null;
	}

}